package IC.lir;

import java.util.ArrayList;
import java.util.List;
import IC.Constants;
import IC.lir.instructions.Label;

/**
 * 
 * LIRClass Object
 *
 */
public class LIRClass extends LIRObject {

	private String Name;
	private LIRClassLayout Cl;
	private List<LIRMethod> Methods;
	
	//C'tor
	public LIRClass(String Name, LIRProgram parent, LIRClassLayout Cl) 
	{
		super(parent);
		this.Name = Name;
		this.Label = new Label("_DV_" + Name);
		this.Cl = Cl;
		Cl.setClassRef(this);
		this.Methods = new ArrayList<LIRMethod>();
	}
	
	public String getName() {
		return Name;
	}
	
	public LIRClassLayout getClassLayout() {
		return Cl;
	}

	public List<LIRMethod> getMethods() {
		return Methods;
	}
	
	@Override
	public String toString() {
		StringBuffer s = new StringBuffer();
		s.append("### Class " + Name +" ###"+ Constants.LINE_BREAK);
		for (LIRMethod m : Methods)
			s.append(m + Constants.LINE_BREAK);
		return s.toString();
	}	
}
